/**
 * file
 */
package com.tdkj.action.front.member.seller.shop;

import java.util.List;

import javax.annotation.Resource;

import com.opensymphony.xwork2.ActionContext;
import com.tdkj.action.BaseAction;
import com.tdkj.model.shop.BeanGoodShowcaseCustom;
import com.tdkj.model.shop.BeanGoodShowcaseCustomBuy;
import com.tdkj.model.user.BeanUser;
import com.tdkj.service.ServiceException;
import com.tdkj.service.shop.IBeanGoodShowcaseCustomBuyService;
import com.tdkj.service.shop.IBeanGoodShowcaseCustomService;
import com.tdkj.util.PublicConfing;

public class GoodShowcaseAction extends BaseAction {
	
	private Long id;
	private Long customId;
	private Long userId;
	
	private BeanGoodShowcaseCustomBuy buy;
	
	private List<BeanGoodShowcaseCustomBuy> buys;
	
	private List<BeanGoodShowcaseCustom> customs;
	
	private IBeanGoodShowcaseCustomBuyService goodShowcaseCustomBuyService;
	
	private IBeanGoodShowcaseCustomService goodShowcaseCustomService;
	
	@Override
	public String execute() {
		BeanUser user  = (BeanUser)ActionContext.getContext().getSession().get(PublicConfing.MEMBER_MEMBWE_OBJ_STRING_CONFIG);
		userId = user.getId();
		buys = goodShowcaseCustomBuyService.getBuyLogs(userId);
		customs = goodShowcaseCustomService.findAll(BeanGoodShowcaseCustom.class);
		return "success";
	}
	
	public String add() throws ServiceException {
		BeanUser user  = (BeanUser)ActionContext.getContext().getSession().get(PublicConfing.MEMBER_MEMBWE_OBJ_STRING_CONFIG);
		userId = user.getId();
		
		goodShowcaseCustomBuyService.addBuy(userId, customId);
		return execute();
	}
	
	public String customs() {
		customs = goodShowcaseCustomService.findAll(BeanGoodShowcaseCustom.class);
		return "customs";
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the customId
	 */
	public Long getCustomId() {
		return customId;
	}

	/**
	 * @param customId the customId to set
	 */
	public void setCustomId(Long customId) {
		this.customId = customId;
	}

	/**
	 * @return the userId
	 */
	public Long getUserId() {
		return userId;
	}

	/**
	 * @param userId the userId to set
	 */
	public void setUserId(Long userId) {
		this.userId = userId;
	}

	/**
	 * @return the buy
	 */
	public BeanGoodShowcaseCustomBuy getBuy() {
		return buy;
	}

	/**
	 * @param buy the buy to set
	 */
	public void setBuy(BeanGoodShowcaseCustomBuy buy) {
		this.buy = buy;
	}

	/**
	 * @return the buys
	 */
	public List<BeanGoodShowcaseCustomBuy> getBuys() {
		return buys;
	}

	/**
	 * @param buys the buys to set
	 */
	public void setBuys(List<BeanGoodShowcaseCustomBuy> buys) {
		this.buys = buys;
	}

	/**
	 * @return the customs
	 */
	public List<BeanGoodShowcaseCustom> getCustoms() {
		return customs;
	}

	/**
	 * @param customs the customs to set
	 */
	public void setCustoms(List<BeanGoodShowcaseCustom> customs) {
		this.customs = customs;
	}

	/**
	 * @param goodShowcaseCustomService the goodShowcaseCustomService to set
	 */
	@Resource
	public void setGoodShowcaseCustomService(
			IBeanGoodShowcaseCustomService goodShowcaseCustomService) {
		this.goodShowcaseCustomService = goodShowcaseCustomService;
	}

	/**
	 * @param goodShowcaseCustomBuyService the goodShowcaseCustomBuyService to set
	 */
	@Resource
	public void setGoodShowcaseCustomBuyService(
			IBeanGoodShowcaseCustomBuyService goodShowcaseCustomBuyService) {
		this.goodShowcaseCustomBuyService = goodShowcaseCustomBuyService;
	}


	
	
}
